package net.wexoo.onlinedivelog.view.pages.main;

import net.wexoo.onlinedivelog.reusable.page.WEXWebPage;
import net.wexoo.onlinedivelog.view.panels.user.LoggedInPanel;
import net.wexoo.onlinedivelog.view.panels.user.LoginPanel;
import net.wexoo.onlinedivelog.view.util.DiveLogSession;
import net.wexoo.onlinedivelog.view.util.NotificationPanel;

public abstract class MainPage extends WEXWebPage {

  private static final long serialVersionUID = 1L;
  protected NotificationPanel notificationPanel;

  public MainPage() {

    notificationPanel = new NotificationPanel("mainNotificationPanel");
    add(notificationPanel);

    if (((DiveLogSession) getSession()).getLoggedInPerson() != null)
      add(new LoggedInPanel("loginPanel", notificationPanel));
    else
      add(new LoginPanel("loginPanel", notificationPanel));
  }
}